package com.mib.browser;

import javax.swing.*;

public class SetOperationDialog extends JDialog {
    private MIBBrowserFrame parent;
    private JButton cancelButton;
    private JComboBox dataTypeComboBox;
    private JLabel jLabel1;
    private JLabel jLabel2;
    private JLabel jLabel3;
    private JLabel jLabel4;
    private JLabel jLabel5;
    private JTextField oidTextField;
    private JButton okButton;
    private JTextField valueTextField;

    public SetOperationDialog(MIBBrowserFrame parent, boolean modal) {
        super(parent, modal);
        this.parent = parent;
        this.initComponents();
    }

    private void initComponents() {
        this.valueTextField = new JTextField();
        this.jLabel3 = new JLabel();
        this.dataTypeComboBox = new JComboBox();
        this.jLabel1 = new JLabel();
        this.oidTextField = new JTextField();
        this.jLabel2 = new JLabel();
        this.jLabel4 = new JLabel();
        this.jLabel5 = new JLabel();
        this.cancelButton = new JButton();
        this.okButton = new JButton();
        this.setDefaultCloseOperation(2);
        this.setTitle("SNMP SET");
        this.setResizable(false);
        this.jLabel3.setText("Value");
        this.dataTypeComboBox.setModel(new DefaultComboBoxModel(new String[]{"Octet String", "Integer", "OID", "Gauge", "32-bit Counter", "Ip Address", "TimeTicks", "64-bit Counter", "Unsigned Integer", "BITS"}));
        this.jLabel1.setText("Data Type");
        this.jLabel2.setText("OID");
        this.jLabel4.setText("The SNMP Set operation allows you to modify the value of the specified OID.");
        this.jLabel5.setText("The community string you use has to have write rights.");
        this.cancelButton.setText("Cancel");
        this.okButton.setText("OK");
        GroupLayout layout = new GroupLayout(this.getContentPane());
        this.getContentPane().setLayout(layout);
//        layout.setHorizontalGroup(layout.createParallelGroup(1).add(layout.createSequentialGroup().addContainerGap().add(layout.createParallelGroup(1).add(this.jLabel5, -1, 368, 32767).add(this.jLabel4, -1, -1, 32767).add(layout.createParallelGroup(2, false).add(1, layout.createSequentialGroup().add(this.jLabel3).addPreferredGap(0).add(this.valueTextField)).add(1, layout.createSequentialGroup().add(this.jLabel1).add(12, 12, 12).add(this.dataTypeComboBox, 0, 0, 32767)).add(1, layout.createSequentialGroup().add(this.jLabel2).addPreferredGap(0).add(this.oidTextField, -1, 345, 32767))).add(2, layout.createSequentialGroup().add(this.okButton).addPreferredGap(0).add(this.cancelButton))).addContainerGap()));
//        layout.setVerticalGroup(layout.createParallelGroup(1).add(2, layout.createSequentialGroup().addContainerGap().add(this.jLabel4).addPreferredGap(0).add(this.jLabel5).addPreferredGap(0, 18, 32767).add(layout.createParallelGroup(3).add(this.jLabel2).add(this.oidTextField, -2, -1, -2)).addPreferredGap(0).add(layout.createParallelGroup(3).add(this.jLabel1).add(this.dataTypeComboBox, -2, -1, -2)).addPreferredGap(0).add(layout.createParallelGroup(3).add(this.jLabel3).add(this.valueTextField, -2, -1, -2)).add(6, 6, 6).add(layout.createParallelGroup(3).add(this.cancelButton).add(this.okButton)).addContainerGap()));
        this.pack();
    }

    public String getOID() {
        return this.oidTextField.getText();
    }

    public void setOID(String oid) {
        this.oidTextField.setText(oid);
    }

    public String getValue() {
        return this.valueTextField.getText();
    }

    public void setValue(String value) {
        this.valueTextField.setText(value);
    }

    public int getSelectedDataTypeIndex() {
        return this.dataTypeComboBox.getSelectedIndex();
    }
}
